package com.jmpt.fangbohui.adapter;

import java.util.List;

import com.jmpt.fangbohui.R;
import com.jmpt.fangbohui.bean.SeeHouseClientBean.date_value;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SeeHouseClientAdapter extends BaseAdapter{

	private List<date_value> mData;
	private Context mContext;
	
	public SeeHouseClientAdapter(Context mContext,List<date_value> mData){
		this.mContext = mContext;
		this.mData = mData;
	}
	@Override
	public int getCount() {
		return mData.size();
	}

	@Override
	public Object getItem(int position) {
		return mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = View.inflate(mContext, R.layout.item_see_house_client, null);
			holder.tv_see_house_client_name = (TextView) convertView.findViewById(R.id.tv_see_house_client_name);
			holder.tv_see_house_client_phone = (TextView) convertView.findViewById(R.id.tv_see_house_client_phone);
			holder.tv_see_house_client_houseTitle = (TextView) convertView.findViewById(R.id.tv_see_house_client_houseTitle);
			holder.tv_see_house_client_addTime = (TextView) convertView.findViewById(R.id.tv_see_house_client_addTime);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		holder.tv_see_house_client_name.setText(mData.get(position).username);
		holder.tv_see_house_client_phone.setText(mData.get(position).phone);
		holder.tv_see_house_client_houseTitle.setText(mData.get(position).houseTitle);
		holder.tv_see_house_client_addTime.setText(mData.get(position).addtime);
		return convertView;
	}
	public class ViewHolder{
		public TextView tv_see_house_client_name;
		public TextView tv_see_house_client_phone;
		public TextView tv_see_house_client_houseTitle;
		public TextView tv_see_house_client_addTime;
	}
}
